<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>

        window.onload=function()
        {
            var param=location.search;
            param=decodeURIComponent(param)
            param=param.substr(1);   //把问号截取了
            param=param.split('&');//把参数的连接符&分割并把字符串分割为数组
            var username=param[0]   //username=trump
            var password=param[1]   //password=admin88
            username=username.split('=')[1]    // ['username','trump'] ==>trump 输入的用户名
            password=password.split('=')[1]    // ['password','admin88'] ==> admin88 输入的密码

            if(username!='张三'||password!='admin88')
            {
                alert("账号或密码错误")
                history.back()
            }

            var loginCount=localStorage.getItem('counter') //获取登录次数
            if(loginCount==null)  //第一次登录获取次数为null
            {
                loginCount=0
            }
            loginCount=parseInt(loginCount)+1   //把获取的登录次数+1
            localStorage.setItem('counter',loginCount)  //然后设置总共的登录次数
            document.querySelector('b').innerText=loginCount


            document.querySelector('span').innerText=username
            console.log(param);
            console.log(username);
            console.log(password);
        }
    </script>
</head>
<body>
    <h5>粤嵌管理后台</h5>
    <p>欢迎<span>XX</span>第<b></b>次登录</p>
    
</body>
</html>